package com.qingke.easyjava.xmlconverter;

import java.io.File;
import java.util.List;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;

public class RegionInfoConverter {

    public static void main(String[] args) {
        List<Region> regions = RegionInfoParser.parseRegions("info.txt");

        RegionList regionListObj = new RegionList();
        regionListObj.setRegions(regions);

        try {
            JAXBContext ctx = JAXBContext.newInstance(RegionList.class);
            ctx.createMarshaller().marshal(regionListObj, new File("info.xml"));
        } catch (JAXBException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
